package org.fastmvc.ioc.scan;

import java.util.Map;

import org.fastmvc.config.Config;
import org.fastmvc.config.ContextConfig;
import org.fastmvc.ioc.parse.Parse;
import org.fastmvc.ioc.parse.impl.YmlParse;
import org.fastmvc.scan.Scanner;

/**
 * <类描述>
 *
 * @author tangch
 * @date 2017年11月10日 15:51
 */
public class ConfigScanner implements Scanner {

	private Parse parse = new YmlParse();

	@Override
	public Config scan(String path) {
		Map<Object,Object> data = this.parse.parse(this.getClass().getResourceAsStream(path), Map.class);
		ContextConfig contextConfig = new ContextConfig();
		contextConfig.setData(data);
		return contextConfig;
	}
}
